<?php  declare(strict_types=1);
namespace App\Controllers;

use Framework\Validate\Validator;

use Framework\{
	App,
	Controller
};

use Monolog\{
	Logger,
	Handler\StreamHandler,
	Handler\FirePHPHandler
};


use Framework\Database\Db;
use App\Models\User;

use GuzzleHttp\Client;

use Resource\Request;
use Framework\Redis\Connection;

// use Framework\Facades\Request;
// use Framework\Facades\Config;

// use Config;

class IndexController extends Controller
{
	public function validate($data, $rules, $messages=[])
	{
		return (
			new \Framework\Validate\Validator([], $data, $rules, $messages)
		);
	}


	function index($request, $name='99')
	{
		$data = [
			'username' => 'tangzhangming',
			'title'    => 'required',
			'age'      => 99,
		];


		$validate = Validator::make($data, [
		    'username' => ['max:255','required'],
		    // 'title' => ['required', 'unique:posts', 'max:255'],
		    'age' => ['max:50', 'string'],
			]);


		print_r( $validate->getErrors() ); 

		return 'end';
	}
}